<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
      
<ui:composition template="/restrito/template.xhtml">

<ui:define name="menu"><ui:include src="menu.xhtml"/></ui:define>

<ui:define name="corpo">
<div class="container">
	<!-- h:button outcome="manterempresa" value="Cadastrar estabelecimento" styleClass="btn-large btn-primary" /-->
	<ui:include src="../mensagem.xhtml"/>
	<h:form id="f">
    	<table class="table table-striped table-bordered tabela centralizado">
    	<thead>
    		<tr>
    			<th colspan="5">Estabelecimentos cadastrados</th>
	    	</tr>
    		<tr>
    			<th>CNES</th>
    			<th>CNPJ</th>
    			<th>Nome fantasia</th>
    			<th>Endereço</th>
    			<th></th>
	    	</tr>
	    </thead>
	    <tbody>
	    	<ui:repeat var="e" value="#{consultarEmpresaMB.lsEmpresa}" varStatus="i">
    		<tr>
    			<td>#{e.cnes}</td>
    			<td><h:outputText value="#{e.cnpj}"><f:converter converterId="conversorCNPJ"/></h:outputText></td>
    			<td>#{e.nomeFantasia}</td>
    			<td>#{e.endereco}, #{e.numero}</td>
    			<td>
    				<h:link value="alterar" outcome="manterempresa">
    					<f:param name="idEmpresa" value="#{e.idEmpresa}" />
    				</h:link>
    				<span style="margin-left:5px;margin-right:5px">|</span>
    				<a4j:commandLink value="excluir" action="#{consultarEmpresaMB.excluir}" render="f" onclick="if(!confirm('Tem certeza que deseja excluir esse estabelecimento?'))return false;">
    					<f:param name="index" value="#{i.index}" />
    				</a4j:commandLink>
    			</td>
	    	</tr>
	    	</ui:repeat>
	    </tbody>
 		</table>
    </h:form>
</div>
</ui:define>
</ui:composition>
</html>
